
			
			<div class="clear"></div> <!-- End .clear -->
			
			<div class="content-box"><!-- Start Content Box -->
				
				<div class="content-box-header">
					
					<h3>Content box</h3>
					
					<ul class="content-box-tabs"><!-- href must be unique and match the id of target div -->
						<li><a href="#tab2" class="default-tab">Forms</a></li>
					</ul>
					
					<div class="clear"></div>
					
				</div> <!-- End .content-box-header -->
				
				<div class="content-box-content">
					
					<div class="tab-content default-tab" id="tab2">
					
						<form action="" method="post" enctype="multipart/form-data" id="admin_ins">
							
							<fieldset> <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
								
								<p>
									<label>用户名</label>
										<input class="text-input small-input" type="text" id="username" name="ueername" /> <!-- Classes for input-notification: success, error, information, attention -->
										<br /><small id="musername">账号由8-18位数字字母组成,首字母不为数字且不可更改,</small>
								</p>
								
								<p>
									<label>昵称</label>
										<input class="text-input small-input" type="text" id="nicheng" name="nicheng" /> <!-- Classes for input-notification: success, error, information, attention -->
										<br /><small id="mnicheng">昵称不可重复</small>
								</p>

								<p>
									<label>性别</label>
									<input type="radio" name="sex" value="1" checked="checked"> 男
									<input type="radio" name="sex" value="0"> 女
									<br /><small id="msex">性别选择后不可更改</small>
								</p>

								<p>
									<label>密码</label>
										<input class="text-input small-input" type="password" id="password"  /> <!-- Classes for input-notification: success, error, information, attention -->
										<br /><small id="mpassword">密码由6-10位数字字母组成</small>
								</p>

								<p>
									<label>确认密码</label>
										<input class="text-input small-input" type="password" id="passworda" name="passworda" /> <!-- Classes for input-notification: success, error, information, attention -->
										<br /><small id="mpassworda">确认密码需与密码相一致</small>
								</p>



								<p>
									<label>手机号码</label>
										<input class="text-input small-input" type="text" id="phone" name="phone" /> <!-- Classes for input-notification: success, error, information, attention -->
										<br /><small id="mphone">填写手机号码</small>
								</p>

								<p>
									<label>邮箱</label>
										<input class="text-input small-input" type="text" id="email" name="email" /> <!-- Classes for input-notification: success, error, information, attention -->
										<br /><small id="memail">填写邮箱账号</small>
								</p>
								
								
								
								
								
								
								<p>
									<label>权限角色</label>              
									<select name="permission" id="permission" class="small-input " >
										<option value="0">无角色</option>

										<?php foreach($permission as $perm):?>
										<option value="<?php echo $perm['id'];?>"><?php echo $perm['per_name'];?></option>
										<?php endforeach ; ?>
									</select> 
								</p>

								<p id="waterCon">  </p><!--空的P标签用于当水印类别是图片或文字时显示相对饮的控件-->

							
								
								
								
							
								
								<p>
									<input class="button" type="submit" value="提交" />
									<small id="msub"></small>
								</p>
								
							</fieldset>
							
							<div class="clear"></div><!-- End .clear -->
							
						</form>
						
					</div> <!-- End #tab2 -->        
					
				</div> <!-- End .content-box-content -->
				
			</div> <!-- End .content-box -->
			
			
			<script type="text/javascript">

				//用户名无刷新验证
				$("#username").blur(function(){
					var username = $("#username").val();

					if(username==''){

						$("#musername").text('用户名不可为空').css('color','red');

						return false;
					}

					$.ajax({
						url:'',

						type: 'post',

						data:{uname:username},

						dataType:'json',

						success : function(msg){
							if(msg.uuniqueness==1){
								$("#musername").text('用户名已存在').css('color','red');
								return false;
							}else if(msg.urule == 0){
								$("#musername").text('用户名格式错误').css('color','red');
								return false;
							}else{
								$("#musername").text('用户名可用').css('color','green');
							}
						}


					})
					return false;
					// alert(username);
				})

				//昵称验证
				$("#nicheng").blur(function(){
					var nicheng = $("#nicheng").val();

					if(nicheng==''){

						$("#mnicheng").text('昵称不可为空').css('color','red');

						return false;
					}

					$.ajax({
						url:'',

						type: 'post',

						data:{ncheng:nicheng},

						dataType:'json',

						success : function(msg){
							if(msg==1){
								$("#mnicheng").text('该昵称已存在').css('color','red');
								return false;
							}else{
								$("#mnicheng").text('该昵称可用').css('color','green');
							}
						}


					})
					return false;
					// alert(username);
				})


				//密码密码  : BUG:有个下拉框 选择后昵称若为空会被填上 
				$("#password").blur(function(){
					var password = $("#password").val();

					if(password==''){

						$("#mpassword").text('密码不可为空').css('color','red');

						return false;
					}


					$.ajax({
						url : '',

						type : 'post',

						data : {password : password},

						dataType : 'json',

						success : function(msg){

							if(msg == 0){

								$("#mpassword").text('密码由6-10位字母或数字组成').css('color','red');

								return false;

							}else{

								$("#mpassword").text('密码格式正确').css('color','green');

							}
						}
					})
					

					
					return false;
					// alert(username);
				})

				$("#passworda").blur(function(){
					var passworda = $("#passworda").val();

					var password = $("#password").val();

					if(passworda==''){

						$("#mpassworda").text('确认密码不可为空').css('color','red');

						return false;
					}else if(passworda!=password){
						$("#mpassworda").text('两次密码不一致').css('color','red');

						return false;
					}else{
						$("#mpassworda").text('该密码可用').css('color','green');
					}

					
					return false;
					// alert(username);
				})

				//手机号码格式、唯一新验证
				$("#phone").blur(function(){
					var phone = $("#phone").val();

					if(phone==''){

						$("#mphone").text('手机号码不可为空').css('color','red');

						return false;
					}

					$.ajax({
						url:'',

						type: 'post',

						data:{phone:phone},

						dataType:'json',

						success : function(msg){
							if(msg.prule==0){

								$("#mphone").text('手机号格式错误').css('color','red');
								return false;

							}else if(msg.puniqueness==1){

								$("#mphone").text('手机号码已存在').css('color','red');

							}else{

								$("#mphone").text('手机号码格式正确').css('color','green');
							}
						}


					})
					return false;
					// alert(username);
				})

				$("#email").blur(function(){
					var email = $("#email").val();

					if(email==''){

						$("#memail").text('邮箱号码不可为空').css('color','red');

						return false;
					}

					$.ajax({
						url:'',

						type: 'post',

						data:{email:email},

						dataType:'json',

						success : function(msg){
							if(msg.erule==0){

								$("#memail").text('邮箱格式错误').css('color','red');
								return false;

							}else if(msg.euniqueness == 1){

								$("#memail").text('该邮箱已存在').css('color','red');
								return false;

							}else{

								$("#memail").text('该邮箱格式正确').css('color','green');	

							}
						}


					})
					return false;
					// alert(username);
				})

				$("#admin_ins").submit(function(){
					var username = $("#username").val();
					var nicheng = $("#nicheng").val();
					var password = $("#password").val();
					var phone = $("#phone").val();
					var email = $("#email").val();
					var permission = $("#permission").val();
					var sex = $("input:radio:checked").val();

					var musername = $("#musername").text();
					var mnicheng = $("#mnicheng").text();
					var mpassword = $("#mpassword").text();
					var mpassworda = $("#mpassworda").text();
					var mphone = $("#mphone").text();
					var memail = $("#memail").text();

					if(email=='' || username =='' || nicheng=='' || password == '' || phone=='' ){

						$("#msub").text('数据不可为空').css('color','red');

						return false;
					}else if(musername != '用户名可用' || mnicheng != '该昵称可用' || mpassword != '密码格式正确' || mphone != '手机号码格式正确' || memail != '该邮箱格式正确' || mpassworda !='该密码可用'){

						$("#msub").text('确认数据填写正确后再提交').css('color','red');

						return false;

					}else{
						$("#msub").text('').css('color','green');
					}
					
					
					$.ajax({
						url:'',

						type: 'post',

						data:{susername:username,snicheng:nicheng,spassword:password,sphone:phone,semail:email ,spermission : permission,ssex:sex,submit : 1},

						dataType:'json',

						success : function(msg){
							if(msg==1){
								$("#admin_ins").text('添加成功');
								return false;
							}else{
								$("#admin_ins").text('添加失败');
							}
						}


					})
					return false;
					// alert(username);
				})
			</script>

			
			
			<!-- Start Notifications -->
			
			
			
			
			<!-- End Notifications -->
			
			